package com.cy.study.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cy.study.common.Response;
import com.cy.study.entity.MediaEntity;
import com.cy.study.req.MediaListReq;
import com.cy.study.service.MediaService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * 小节视频控制器
 */
@RestController
@RequiredArgsConstructor
@Slf4j
@RequestMapping("/media")
@CrossOrigin
public class MediaController {

    private final MediaService mediaService;

    /**
     * 获取小节视频列表
     * @param req
     * @return
     */
    @PostMapping("/list")
    public Response<Page<MediaEntity>> mediaList(@RequestBody MediaListReq req){
        Page<MediaEntity> res = mediaService.mediaList(req);
        return Response.success(res);
    }

}
